ACCESS_FLAG_DIC = {
    'ACC_PUBLIC': 0x0001,  # class field method
    'ACC_PRIVATE': 0x0002,  # field method
    'ACC_PROTECTED': 0x0004,  # field method
    'ACC_STATIC': 0x0008,  # field method
    'ACC_FINAL': 0x0010,  # class field method
    'ACC_SUPER': 0x0020,  # class
    'ACC_SYNCHRONIZED': 0x0020,  # method
    'ACC_VOLATILE': 0x0040,  # field
    'ACC_BRIDGE': 0x0040,  # method
    'ACC_TRANSIENT': 0x0080,  # field
    'ACC_VARARGS': 0x0080,  # method
    'ACC_NATIVE': 0x0100,  # method
    'ACC_INTERFACE': 0x0200,  # class
    'ACC_ABSTRACT': 0x0400,  # class       method
    'ACC_STRICT': 0x0800,  # method
    'ACC_SYNTHETIC': 0x1000,  # class field method
    'ACC_ANNOTATION': 0x2000,  # class
    'ACC_ENUM': 0x4000  # class field
}


class AccessFlag:
    def __init__(self, code):
        self.code = code
        self.value = ACCESS_FLAG_DIC[self.code]


class ACC_PUBLIC(AccessFlag):
    # class field method
    def __init__(self):
        super().__init__(code='ACC_PUBLIC')


class ACC_PRIVATE(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_PRIVATE')


class ACC_PROTECTED(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_PROTECTED')


class ACC_STATIC(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_STATIC')


class ACC_FINAL(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_FINAL')


class ACC_SUPER(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_SUPER')


class ACC_SYNCHRONIZED(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_SYNCHRONIZED')


class ACC_VOLATILE(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_VOLATILE')


class ACC_BRIDGE(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_BRIDGE')


class ACC_TRANSIENT(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_TRANSIENT')


class ACC_VARARGS(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_VARARGS')


class ACC_NATIVE(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_NATIVE')


class ACC_INTERFACE(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_INTERFACE')


class ACC_ABSTRACT(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_ABSTRACT')


class ACC_STRICT(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_STRICT')


class ACC_SYNTHETIC(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_SYNTHETIC')


class ACC_ANNOTATION(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_ANNOTATION')


class ACC_ENUM(AccessFlag):
    def __init__(self):
        super().__init__(code='ACC_ENUM')


class AccessFlagHelper:
    @staticmethod
    def isPublic(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_PUBLIC'] != 0

    @staticmethod
    def isPrivate(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_PRIVATE'] != 0

    @staticmethod
    def isProtected(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_PROTECTED'] != 0

    @staticmethod
    def isStatic(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_STATIC'] != 0

    @staticmethod
    def isFinal(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_FINAL'] != 0

    @staticmethod
    def isSuper(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_SUPER'] != 0

    @staticmethod
    def isSynchronized(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_SYNCHRONIZED'] != 0

    @staticmethod
    def isVolatile(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_VOLATILE'] != 0

    @staticmethod
    def isBridge(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_BRIDGE'] != 0

    @staticmethod
    def isTransient(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_TRANSIENT'] != 0

    @staticmethod
    def isVarargs(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_VARARGS'] != 0

    @staticmethod
    def isNative(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_NATIVE'] != 0

    @staticmethod
    def isInterface(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_INTERFACE'] != 0

    @staticmethod
    def isAbstract(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_ABSTRACT'] != 0

    @staticmethod
    def isStrict(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_STRICT'] != 0

    @staticmethod
    def isSynthetic(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_SYNTHETIC'] != 0

    @staticmethod
    def isAnnotation(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_ANNOTATION'] != 0

    @staticmethod
    def isEnum(accessFlag: int) -> bool:
        return accessFlag & ACCESS_FLAG_DIC['ACC_ENUM'] != 0
